﻿using ConsoleApp1.Entity;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class DbInit : DropCreateDatabaseAlways<AdminDB>
    {
        protected override void Seed(AdminDB DbContext)
        {            

            var class1 = new Class
            {
                ClassName = "终极一班"
            };
            DbContext.Classes.Add(class1);
            DbContext.SaveChanges();


            var class2 = new Class
            {
                ClassName = "终极二班"
            };
            DbContext.Classes.Add(class2);
            DbContext.SaveChanges();
            var user = new Users
            {
                UserName = "超超超超超超超超超级赛亚人",
                ClassId = class1.Id
            };


            DbContext.Users.Add(user);
            DbContext.SaveChanges();
            base.Seed(DbContext);



        }
    }
}
